home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-01-10 | 4.8 KB | 108 lines | [TEXT/R*ch] |
- Standard Module `ic'
- ====================
-
- This module provides access to macintosh Internet Config package, which
- stores preferences for Internet programs such as mail address, default
- homepage, etc. Also, Internet Config contains an elaborate set of
- mappings from Macintosh creator/type codes to foreign filename
- extensions plus information on how to transfer files (binary, ascii,
- etc).
-
- There is a low-level companion module `icglue' which provides the basic
- ic access functionality. This low-level module is not documented, but
- the docstrings of the routines document the parameters and the routine
- names are the same as for the Pascal or C API to Internet Config, so
- the standard IC programmers documentation can be used if this module is
- needed.
-
- The `ic' module defines the `error' exception and symbolic names for
- all error codes IC can produce, see the source for details.
-
- The `ic' module defines the following functions:
-
- - function of module ic: IC ([SIGNATURE, IC])
- Create an internet config object. The signature is a 4-char creator
- code of the current application (default `'Pyth'') which may
- influence some of ICs settings. The optional IC argument is a
- low-level `icinstance' created beforehand, this may be useful if
- you want to get preferences from a different config file, etc.
-
- - function of module ic: launchurl (URL [, HINT])
-
- - function of module ic: parseurl (DATA [, START, END, HINT])
-
- - function of module ic: mapfile (FILE)
-
- - function of module ic: maptypecreator (TYPE, CREATOR [, FILENAME])
-
- - function of module ic: settypecreator (FILE)
- These functions are "shortcuts" to the methods of the same name,
- described below.
-
-
- IC objects
- ----------
-
- IC objects have a mapping interface, hence to obtain the mail address
- you simply get `ic['MailAddress']'. Assignment also works, and changes
- the option in the configuration file.
-
- The module knows about various datatypes, and converts the internal IC
- representation to a "logical" python datastructure. Running the `ic'
- module standalone will run a test program that lists all keys and
- values in your IC database, this will have to server as documentation.
-
- If the module does not know how to represent the data it returns an
- instance of the ICOPAQUEDATA type, with the raw data in its DATA
- attribute. Objects of this type are also acceptable values for
- assignment.
-
- Besides the dictionary interface IC objects have the following methods:
-
- - Method on IC object: launchurl (URL [, HINT])
- Parse the given URL, lauch the correct application and pass it the
- URL. The optional HINT can be a scheme name such as `mailto:', in
- which case incomplete URLs are completed with this scheme
- (otherwise incomplete URLs are invalid).
-
- - Method on IC object: parseurl (DATA [, START, END, HINT])
- Find an URL somewhere in DATA and return start position, end
- position and the URL. The optional START and END can be used to
- limit the search, so for instance if a user clicks in a long
- textfield you can pass the whole textfield and the click-position
- in START and this routine will return the whole URL in which the
- user clicked. HINT is again an optional scheme used to complete
- incomplete URLs.
-
- - Method on IC object: mapfile (FILE)
- Return the mapping entry for the given FILE, which can be passed
- as either a filename or an FSSPEC object, and which need not exist.
-
- The mapping entry is returned as a tuple `(version, type, creator,
- postcreator, flags, extension, appname, postappname, mimetype,
- entryname)', where VERSION is the entry version number, TYPE is
- the 4-char filetype, CREATOR is the 4-char creator type,
- POSTCREATOR is the 4-char creator code of an optional application
- to post-process the file after downloading, FLAGS are various bits
- specifying whether to transfer in binary or ascii and such,
- EXTENSION is the filename extension for this file type, APPNAME is
- the printable name of the application to which this file belongs,
- POSTAPPNAME is the name of the postprocessing application,
- MIMETYPE is the MIME type of this file and ENTRYNAME is the name
- of this entry.
-
- - Method on IC object: maptypecreator (TYPE, CREATOR [, FILENAME])
- Return the mapping entry for files with given 4-char TYPE and
- CREATOR codes. The optional FILENAME may be specified to further
- help finding the correct entry (if the creator code is `'????'',
- for instance).
-
- The mapping entry is returned in the same format as for MAPFILE.
-
- - Method on IC object: settypecreator (FILE)
- Given an existing FILE, specified either as a filename or as an
- FSSPEC record, set its creator and type correctly based on its
- extension. The finder is told about the change, so the finder icon
- will be updated quickly.
-
-